Repository navigation
refactor(deploy): template-generate the three Postgres manifests - #21
Merged
Harikeshav-R merged 1 commit intoSep 11, 2026
Merged
Conversation
deploy/system/prod-postgres.yaml, twin-postgres.yaml, and system-postgres.yaml were three independently hand-written, near-identical Deployment+Service pairs (identical skeleton; differing only in namespace, image, POSTGRES_DB, resources, host port, and system-postgres's extra init-script ConfigMap/volume) with nothing keeping them from drifting apart. Add deploy/generate_postgres_manifests.py: a plain Python script (fits ADR-004 "Python everywhere" -- this repo has no Helm/Kustomize/Jsonnet anywhere, and adopting one would need a new ADR, out of scope here) that builds each manifest as a dict from a shared template function plus a small per-instance parameter table, and dumps it with PyYAML. --check renders in-memory and diffs (structurally, not byte-for-byte, since PyYAML formatting need not match hand-written style) against the committed files, exiting non-zero on drift; wired into tests/unit/deploy/test_system_manifests.py so drift fails CI. The three committed files are now generator output (regenerated via this script) rather than hand-maintained; the only textual diff from the prior hand-written versions is cosmetic YAML quoting. Documents the generator in docs/02-architecture.md §2.10. Implements build-plan step A1.5/A1.6 (refactor on already-completed manifests). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CzBeBUsZmE38K1kWeLMhNh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Build-Plan Step Implemented
Checkpoint Execution & Output
ADRs Relied On
adopting Helm/Kustomize/Jsonnet, which this repo has never used and which would
need its own ADR.
in ust-system) -- unchanged, just now generated rather than hand-written.
Mock Registry Disclosures
Documentation Updates
docs/02-architecture.md§2.10: notes that the three postgres manifests aregenerated (with
--checkwired into tests), and thatINSTANCESin the generatorscript is the place to edit, not the YAML files directly.
Definition of Done
make checkgreen# MOCKED:marker without a row in docs/MOCKS.mdContext
A
/code-reviewpass against PR #6 flagged the three postgres manifests(
deploy/system/{prod,twin,system}-postgres.yaml) as near-identical, independentlyhand-maintained files with nothing preventing them from silently drifting apart. This
PR replaces hand-maintenance with a generator:
deploy/generate_postgres_manifests.pybuilds each manifest as a Python dict from one template function plus a small
per-instance parameter table (namespace, image,
POSTGRES_DB, resources, host port,and system-postgres's extra init-script ConfigMap), and dumps it with PyYAML. The
generator's own
--checkmode is a new test(
test_postgres_manifests_match_generator) that fails CI the moment a future edit toone file isn't mirrored by regenerating the others.
The three committed files are unchanged in substance -- I ran the generator and
diffed its output against what was already committed before touching anything, and
found the only difference was YAML quoting style (
value: "postgres"vsvalue: postgres), confirming the generator's template faithfully reconstructs theexisting, reviewed manifests rather than silently changing deployed configuration.
No Helm/Kustomize/Jsonnet is introduced (this repo has none today, and adopting one
would need a new ADR per AGENTS.md §2.1/§9) -- the generator is plain Python,
consistent with ADR-004 and the existing
${VAR}+str.replaceconvention usedelsewhere in
deploy/policies/.Base branch is
feat/policies-and-loadgen(PR #6, still open), sincedeploy/system/only exists on that branch's stack.
🤖 Generated with Claude Code
https://claude.ai/code/session_01CzBeBUsZmE38K1kWeLMhNh